package com.yami.shop.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.app.dto.CouponDto;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.CouponRecord;
import com.yami.shop.dao.CouponMapper;
import com.yami.shop.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {
    @Autowired
    private CouponMapper couponMapper;

    @Override
    public List<CouponDto> getCouponByShopId(Long shopId,String userId,Integer couponKind){
        return couponMapper.getCouponByShopId(shopId,userId,couponKind);
    }

    @Override
    public List<CouponDto> getCouponByShopIdAndprodId(Long shopId,String userId,Integer couponKind,Long prodId){
        return couponMapper.getCouponByShopIdAndprodId(shopId,userId,couponKind,prodId);
    }

    @Override
    public IPage<CouponDto> pageByProdId(Page<CouponDto> page,Coupon coupon) {
        return couponMapper.pageByProdId(page, coupon);
    }

    @Override
    public List<CouponDto> getAllCoupon(Long shopId,Long prodId,String userId,int couponKind){
        return couponMapper.getAllCoupon(shopId,prodId,userId,couponKind);
    }

    @Override
    public IPage<CouponDto> couponUseByProdId(Page<CouponDto> page,Coupon coupon) {
        return couponMapper.couponUseByProdId(page, coupon);
    }

    @Override
    public List<CouponDto> getCoupon(String userId) {
        return couponMapper.getCoupon(userId);
    }

    @Override
    public List<Coupon> getAvailableCoupon() {
        return couponMapper.getAvailableCoupon();
    }

    @Override
    public List<Coupon> getUnUsedCoupon(String userId) {
        return couponMapper.getUnUsedCoupon(userId);
    }

    @Override
    public List<Coupon> getUsedCoupon(String userId) {
        return couponMapper.getUsedCoupon(userId);
    }

    @Override
    public List<Coupon> getOverdueCoupon(String userId) {
        return couponMapper.getOverdueCoupon(userId);
    }


}
